@extends('admin.public.admin')
@section('main')
<div class="mws-panel grid_8">
	<div class="mws-panel-header">
    	<span><i class="icon-table"></i>分类列表</span>
    </div>
    <div class="mws-panel-body no-padding">
        <div id="DataTables_Table_1_wrapper" class="dataTables_wrapper" role="grid">
             <form method="get" action="/admin/types">

                      <div id="DataTables_Table_1_length" class="dataTables_length">
               
                        <label>显示 
                            <select size="1" name="count" aria-controls="DataTables_Table_1">
                                <option value="10" @if(!empty($request['count']) && $request['count'] == 10) selected @endif>10</option>
                                <option value="20" @if(!empty($request['count']) && $request['count'] == 20) selected @endif>20</option>
                                <option value="30" @if(!empty($request['count']) && $request['count'] == 30) selected @endif>30</option>
                                <option value="50" @if(!empty($request['count']) && $request['count'] == 50) selected @endif>50</option>
                            </select> 
                        条
                        </label>
                      </div>

            <div class="dataTables_filter" id="DataTables_Table_1_filter">
                    <label>
                        搜索: <input type="text" name="search" value="{{$request['search'] or ''}}" aria-controls="DataTables_Table_1">
                            <input type="submit" class="btn btn-success btn-xs" value="搜索">
                    </label>
            </div>
            </form>
        <table class="mws-table">
            <thead>
                <tr>
                    <th>ID</th>
                    <th>分类名称</th>
                    <th>分类标题</th>
                    <th>创建时间</th>
                    <th>是否楼层</th> 
                    <th>添加子类</th>             
                    <th>操作</th>
                </tr>
            </thead>

            <tbody>
             <?php 
                  $num=0;
                ?>
            	@foreach($data as $k=>$v)
                <tr>
                    <td>{{++$num}}</td>

                     <?php
                     $len = substr_count($v['path'],',');
                     ?>

                    <td>{{str_repeat('|----',$len-1).$v['typename']}}</td>

                    <td>{{$v['title']}}</td>
               
					<td>{{date('Y-m-d H:i:s',$v['createtime'])}}</td>
                @if($v['is_lou'])
					<td align="center"><span class="btn btn-success">是</span></td>

				@else
					<td align="center"><span class="btn btn-danger">否</span></td>
					
				@endif
				 
				@if(substr_count($v['path'],',')>=3)
					<td align="center"><a href="javascript:;"></a></td>
				@else
					<td align="center"><a href="/admin/types/create?id={{$v['id']}}" class="btn btn-primary">添加子类</a></td>
				@endif
                    <td align="center" >
           　
                    	&nbsp;&nbsp;
                    	<a href="/admin/types/{{$v['id']}}/edit"  class="icon-pencil-2" title="修改"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    </td>
                </tr>
                @endforeach
            </tbody>
        </table>

             <!-- 分页 -->
              <div id="page_page">
                   {!! $data->appends($request)->render()!!}
              </div>
        </div>
    </div>
</div>

@endsection